package leecode

func kthToLast(head *ListNode, k int) int {
	var result []int
	dummyHead := &ListNode{}
	dummyHead.Next = head
	cur := dummyHead
	for cur != nil {
		result = append(result, cur.Val)
		cur = cur.Next
	}
	return result[len(result)-k]
}
